package org.phalanx.client.mapeditor;

import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;

import javax.swing.ListModel;
import javax.swing.event.ListDataListener;

import org.phalanx.map.MapTile;
import org.phalanx.map.MapTileSet;

public class PhalanxMapTileSetListModel implements ListModel {
	private MapTileSet currentTileSet;
	private ArrayList<MapTile> mapTileList;
	private Hashtable<MapTile, BufferedImage> tileImageList;

	public PhalanxMapTileSetListModel(MapTileSet t) {
		currentTileSet = t;
		prepareData();
	}

	private void prepareData() {
		mapTileList = new ArrayList<MapTile>();
		tileImageList = new Hashtable<MapTile, BufferedImage>();

		Hashtable<String, MapTile> tileSetTable = currentTileSet
				.getMapTileSetTable();
		Enumeration<String> e = tileSetTable.keys();

		while (e.hasMoreElements()) {
			mapTileList.add(tileSetTable.get(e.nextElement()));
		}
	}

	public void addListDataListener(ListDataListener arg0) {
		// TODO Auto-generated method stub

	}

	public Object getElementAt(int pos) {
		return mapTileList.get(pos);
	}

	public int getSize() {
		// TODO Auto-generated method stub
		return 0;
	}

	public void removeListDataListener(ListDataListener arg0) {
		// TODO Auto-generated method stub

	}

}
